package org.example.utils;

import org.example.domain.po.ErpMenu;

import java.util.List;
import java.util.stream.Collectors;

public class TreeUtil {
    
    public static void reversion(ErpMenu menu, List<ErpMenu> menuList){
        if (menu.isInitialAdd()) menuList.add(menu);
        List<ErpMenu> subMenuList = menu.getChildren();
        if (subMenuList != null && !subMenuList.isEmpty()){
            for (ErpMenu subMenu : subMenuList){ // 递归寻找子节点的子节点
                reversion(subMenu,menuList);
            }
        }
    }
}
